﻿namespace Vdc.Grid
{
    using Vdc.Grid.Design;
    using System;
    using System.ComponentModel;

    [TypeConverter(typeof(GridAddEditDeleteSettingsConverter))]
    public class GridAddEditDeleteSettings : GridPersistentObject, ICloneable
    {
        public object Clone()
        {
            return new GridAddEditDeleteSettings { AddLinksPosition = this.AddLinksPosition, NewRecordPosition = this.NewRecordPosition };
        }

        public virtual bool Equals(GridAddEditDeleteSettings settings)
        {
            return ((this.AddLinksPosition == settings.AddLinksPosition) && (this.NewRecordPosition == settings.NewRecordPosition));
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        [Category("Paging"), NotifyParentProperty(true), Description("Gets or sets a value indicating the location where the add links will be displayed."), Bindable(true), DefaultValue(1)]
        public GridElementPosition AddLinksPosition
        {
            get
            {
                object obj2 = base.ViewState["AddLinksPosition"];
                if (obj2 != null)
                {
                    return (GridElementPosition) obj2;
                }
                return GridElementPosition.Bottom;
            }
            set
            {
                base.ViewState["AddLinksPosition"] = value;
            }
        }

        [NotifyParentProperty(true), Description("Gets or sets a value indicating the location where the new record will be displayed in add mode."), Category("Paging"), DefaultValue(1), Bindable(true)]
        public GridDynamicElementPosition NewRecordPosition
        {
            get
            {
                object obj2 = base.ViewState["NewRecordPosition"];
                if (obj2 != null)
                {
                    return (GridDynamicElementPosition) obj2;
                }
                return GridDynamicElementPosition.Bottom;
            }
            set
            {
                base.ViewState["NewRecordPosition"] = value;
            }
        }
    }
}

